
#include "file_loader.h"

#include <iostream>
#include <fstream>

#include "loaded_file.h"

#include "main_container.h"
#include "errors_warnings.h"
extern MainContainer * CompilerData;

using namespace std;

FileLoader::FileLoader() { }

FileLoader::~FileLoader() { }

void FileLoader::LoadFiles() {
#ifdef TRACE
	CompilerData->LogTrace->ReportEntry("LoadFiles");
#endif

	for(int i = 0; i < CompilerData->Flags->FileNameTable->GetCount(); i++)	{
		// get file name and open file
		string * s = CompilerData->Flags->FileNameTable->GetData(i);

#ifdef TRACE
		CompilerData->LogTrace->ReportLine("Getting ready to read file...");
		CompilerData->LogTrace->ReportValue("s->c_str()", s->c_str());
#endif
        
		// make new file in memory
		LoadedFile * lf = new LoadedFile(s->c_str(), i);
		CompilerData->LoadedFiles->Add(lf);
	}

#ifdef TRACE
	CompilerData->LogTrace->ReportExit("LoadFiles");
#endif
}

